﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Maticsoft.DBUtility;
using System.Data.OracleClient;
using System.Text;

namespace Xiaov.SmartWeb.Application.TZ.XB
{
  public partial class XBTZData : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      string rq1 = "", rq2 = "", jd = "", zz = "", zjxh = "", sgqy = "", sgzt = "", zjjb = "", zjjx = "", zjfl = "";
      if (Request.Form["rq1"] != null)
      { rq1 = Request.Form["rq1"].ToString(); }
      if (Request.Form["rq2"] != null)
      { rq2 = Request.Form["rq2"].ToString(); }
      if (Request.Form["jd"] != null)
      { jd = Request.Form["jd"].ToString(); }
      if (Request.Form["zz"] != null)
      { zz = Request.Form["zz"].ToString(); }
      if (Request.Form["zjxh"] != null)
      { zjxh = Request.Form["zjxh"].ToString(); }
      if (Request.Form["sgqy"] != null)
      { sgqy = Request.Form["sgqy"].ToString(); }
      if (Request.Form["sgzt"] != null)
      { sgzt = Request.Form["sgzt"].ToString(); }
      if (Request.Form["zjjb"] != null)
      { zjjb = Request.Form["zjjb"].ToString(); }
      if (Request.Form["zjjx"] != null)
      { zjjx = Request.Form["zjjx"].ToString(); }
      if (Request.Form["zjfl"] != null)
      { zjfl = Request.Form["zjfl"].ToString(); }
      StringBuilder sql = new StringBuilder();
      sql.Append("select * from tz_xbzjsj where 1=1 ");
      if (rq1 != "")
      { sql.Append(" and rq>='" + rq1 + "' "); }
      if (rq2 != "")
      { sql.Append(" and rq<='" + rq2 + "' "); }
      if (jd != "")
      { sql.Append(" and jd='" + jd + "' "); }
      if (zz != "")
      { sql.Append(" and zz='" + zz + "' "); }
      if (zjxh != "")
      { sql.Append(" and zjxh='" + zjxh + "' "); }
      if (sgqy != "")
      { sql.Append(" and sgqy='" + sgqy + "' "); }
      if (sgzt != "")
      { sql.Append(" and sgzt='" + sgzt + "' "); }
      if (zjjb != "")
      { sql.Append(" and zjjb='" + zjjb + "' "); }
      if (zjjx != "")
      { sql.Append(" and zjjx='" + zjjx + "' "); }
      if (zjfl != "")
      { sql.Append(" and zjfl='" + zjfl + "' "); }
      //OracleParameter[] paras = new OracleParameter[]{
      //    new OracleParameter(":0", OracleType.VarChar,30),
      //    new OracleParameter(":1", OracleType.VarChar,30),
      //    new OracleParameter(":2", OracleType.VarChar,30)};
      //paras[0].Value = Request.QueryString["rq1"].ToString();
      //paras[1].Value = Request.QueryString["rq2"].ToString();
      //paras[2].Value = Request.QueryString["jd"].ToString();
      //DataSet ds = DbHelperOra.Query(sql, paras);
      DataSet ds = DbHelperOra.Query(sql.ToString());
      ds.WriteXml(Response.Output);
      Response.ContentType = "text/plain";
      Response.End();

    }
  }
}